//package controller;
//
//import entity.Admin;
//import service.StudentService;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//
//@WebServlet("/LoginController")
//public class LoginController extends HttpServlet {
//    private static final long serialVersionUID = 1L;
//    StudentService stuService=new StudentService();
//    /**
//     * @see HttpServlet#HttpServlet()
//     */
//    public LoginController() {
//        super();
//        // TODO Auto-generated constructor stub
//    }
//
//    /**
//     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
//     */
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//
//        String name = request.getParameter("name");
//        String pd = request.getParameter("pd");
//
//        Admin admin = stuService.login(name, pd);
//        if (admin != null) {
//            HttpSession session = request.getSession();
//            session.setAttribute("admin", admin);
//            request.getRequestDispatcher("StuListController").forward(request, response);
//
//        } else {
//            request.setAttribute("msg", "用户密码错误!");
//            request.getRequestDispatcher("login.jsp").forward(request, response);
//        }
//    }
//
//    /**
//     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
//     */
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        // TODO Auto-generated method stub
//        doGet(request, response);
//    }
//
//}